#!/usr/bin/perl
# USAGE:

# cd scripts
# ./chema 
# by default will '$db' variable as a database

# or ./scripts/schema ./db_sqlite.db


$sqlite = "sqlite3";
$db = "../db_sqlite.db";
if ( $ARGV[0] ){ $db = $ARGV[0] }  
print $tables = `$sqlite $db ".tables"`;
print "\n";
@tables = split /\s+/, $tables;
for ( @tables ){
 print $schema = `$sqlite $db  ".schema $_"`;
 print "\n";
}

